package br.com.cogerh.sidec.view;

import java.io.IOException;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import javax.faces.context.FacesContext;
import javax.servlet.FilterChain;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpSession;

import br.com.cogerh.sidec.util.LoginFilter;

@ManagedBean(name = "logoutBean")
@SessionScoped
public class LogoutBean {
	
	
	public String logout() throws IOException, ServletException{
		FacesContext fc = FacesContext.getCurrentInstance();  
	       HttpSession session = (HttpSession)fc.getExternalContext().getSession(false);  
	       session.invalidate();
	       LoginFilter lg = new LoginFilter();
	       lg.doFilter(null,null,null);
		
		return "sucesso";

	}
}
